package internet;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo2 {



    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10001);
        //监听链接 返回一个对应的Socket对象
        Socket s = ss.accept();

        BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));

        String line;
        while ((line = br.readLine())!=null) {

            System.out.println(line);
        }

        ss.close();
    }
}
